// 引入axios
import request from '../assets/js/http';

/*校验用户是否登录*/
// 刷新还能保持登录状态
export function checkLogin() {
    let url = 'user/checkLogin';
    return request.post(url);
}

/*获取验证码*/
export function getCode(email) {
    let url = 'user/getCode';
    return request.post(url, {email});
}

export function emailIsValidate(email) {
    let url = 'user/emailIsValidate';
    return request.post(url, {email});
}


/*用户注册 register */
export function register(info) {
    let url = 'user/register';
    return request.post(url, info);
}

/*
* 修改密码
* */
export function changePwd(data) {

    let url = 'user/updatePwd';
    return request.post(url, data);

}

/*
* 修改用户头像
* */

export function updateAvatar(data) {
    let url = 'user/updateAvatar';
    return request.post(url, data);
}

export function uploadAvatar(data) {
    let url = 'upload/store';
    return request.post(url, data);
}

/*用户评论列表*/
export function commentsByUid() {
    let url = 'comment/getUserComment?pageSize=100&currentPage=1&';
    return request.get(url);
}

/*删除评论*/
export function delCommentsByid(id) {
    let url = '/comment/delete/' + id;
    return request.get(url);
}